<template>
  <div>
    <el-form :inline="true" :model="formInline" class="demo-form-inline">
      <el-form-item label="搜索作者名">
        <el-input v-model="formInline.author" placeholder="请输入要搜索的作者名"></el-input>
      </el-form-item>
      <el-form-item label="搜索标题">
        <el-input v-model="formInline.title" placeholder="请输入要搜索的博文标题"></el-input>
      </el-form-item>
      <el-form-item label="时间区间">
        <el-date-picker v-model="formInline.date" type="daterange" range-separator="至"
                        start-placeholder="开始日期" end-placeholder="结束日期">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="博文状态">
        <el-select v-model="formInline.state" placeholder="博文状态">
          <el-option v-for="item in state" :key="item.value"
                     :label="item.label" :value="item.value">
            {{item.label}}
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="onSubmit">查询</el-button>
      </el-form-item>
    </el-form>

    <el-table :data="tableData" stripe style="width: 100%" :show-overflow-tooltip="true" align="center" height="700">
      <el-table-column prop="reginDate" label="创建时间" fixed="left" align="center"></el-table-column>
      <el-table-column prop="userId" label="账户ID" align="center"></el-table-column>
      <el-table-column prop="userName" label="账户昵称" align="center"></el-table-column>
      <el-table-column prop="options" label="操作" min-width="150" align="center"></el-table-column>
    </el-table>

    <div class="page">
      <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
                     :current-page="currentPage"
                     layout=" prev, pager, next" :total="30">
      </el-pagination>
    </div>
  </div>
</template>

<script>
  export default {
    name: "BlogManager",
    data() {
      return {
        formInline: {
          author: '',
          title: '',
          date: [],
          state: ''
        },
        tableData:[],
        currentPage:1,
        state: [
          {label: '正常', value: 0},
          {label: '下架', value: 1},
          {label: '删除', value: 2}
        ]
      }
    },
    methods: {
      onSubmit() {

      },
      handleSizeChange(val) {
        console.log(`每页 ${val} 条`);
      },
      handleCurrentChange(val) {
        console.log(`当前页: ${val}`);
      }
    }
  }
</script>

<style scoped>
  .page {
    width: 100%;
    text-align: center;
    margin-top: 20px;
  }
</style>
